home *** CD-ROM | disk | FTP | other *** search
- //=========================================================
- //
- // show.c
- //
- // void bump(int direction)
- //
- // void showmsg(int msg)
- //
- //==========================================================
-
- // $Id: show.c,v 1.2 1994/02/08 23:33:54 gbj Exp user $
-
- /*
- $Log: show.c,v $
- * Revision 1.2 1994/02/08 23:33:54 gbj
- * First public release.
- *
- * Revision 1.1 1994/02/08 03:16:14 gbj
- * Initial revision
- *
- */
-
- #include "mailer.h"
- #include "utils.h"
-
- static char buf[4096];
-
- void bump(int direction)
- {
- if (direction == 1 )
- {
- cmsg++;
- if (cmsg > maxmsgno)
- cmsg=0;
- }
- else if (direction == -1)
- {
- cmsg--;
- if(cmsg < 0)
- cmsg=maxmsgno;
- }
- return;
- }
-
- void showmsg(int msg)
- {
- FILE *xfd;
- char *bp;
- int res, c, done;
- int line;
-
- if (msg < 0 || msg > maxmsgno)
- {
- fprintf(stderr, "Message %d does not exist\n", msg);
- return;
- }
-
- res=tmp_msg(msg, "show.$$$", FALSE, TRUE);
- if (res)
- return;
- line=0;
- printf("\n Message %d\n\n", msg);
- xfd=fopen("show.$$$", "rb");
- bp=fgets(buf, 4095, xfd);
- while (bp != NULL)
- {
- scaneol(buf);
- strcat(buf, "\n");
- c='\0';
- // Don't show X-Status:
- if (strncmp(buf, "X-Status:", 9) != 0)
- {
- printf("%s", buf);
- line++;
- if (line > 15)
- {
- done=FALSE;
- while (!done)
- {
- printf("\n(C)ontinue or (Q)uit? ");
- c=toupper(getche());
- putchar('\r');
- putchar('\n');
- if (c == 'C')
- {
- done=TRUE;
- line=0;
- }
- else if (c == 'Q')
- done=TRUE;
- }
- }
- }
- if (c != 'Q')
- bp=fgets(buf, 4095, xfd);
- else
- bp=NULL;
- }
- fclose(xfd);
- remove ("show.$$$");
- printf("Press a key");
- getch();
- putchar('\n');
- return;
- }
-